﻿// <copyright file="DateTimeExtensionsTest.cs" company="DotNetLib">
//
// .netlib: http://www.codeplex.com/DotNetLib
//
// This code is released under the New BSD License.
// A copy of this license is available at:
// http://www.codeplex.com/DotNetLib/license
//
// </copyright>

namespace DotNetLib.Tests
{
  using System;
  using global::Microsoft.VisualStudio.TestTools.UnitTesting;

  /// <summary>
  /// This is a test class for DotNetLib.DateTimeExtensions.
  /// </summary>
  [TestClass()]
  public class DateTimeExtensionsTest : TestBase
  {
    [ClassInitialize()]
    public static void Initialize(TestContext testContext)
    {
    }

    [ClassCleanup()]
    public static void Cleanup()
    {
    }

    /// <summary>
    /// A test for IsWeekend.
    /// </summary>
    [TestMethod()]
    public void IsWeekendTest()
    {
      DateTime day = new DateTime(2000, 1, 1);
      Assert.IsTrue(day.IsWeekendDay());

      day = day.AddDays(1);
      Assert.IsTrue(day.IsWeekendDay());

      day = day.AddDays(1);
      Assert.IsFalse(day.IsWeekendDay());

      day = day.AddDays(1);
      Assert.IsFalse(day.IsWeekendDay());

      day = day.AddDays(1);
      Assert.IsFalse(day.IsWeekendDay());

      day = day.AddDays(1);
      Assert.IsFalse(day.IsWeekendDay());

      day = day.AddDays(1);
      Assert.IsFalse(day.IsWeekendDay());
    }

    /// <summary>
    /// A test for IsWeekday.
    /// </summary>
    [TestMethod()]
    public void IsWeekdayTest()
    {
      DateTime day = new DateTime(2000, 1, 1);
      Assert.IsFalse(day.IsWeekday());

      day = day.AddDays(1);
      Assert.IsFalse(day.IsWeekday());

      day = day.AddDays(1);
      Assert.IsTrue(day.IsWeekday());

      day = day.AddDays(1);
      Assert.IsTrue(day.IsWeekday());

      day = day.AddDays(1);
      Assert.IsTrue(day.IsWeekday());

      day = day.AddDays(1);
      Assert.IsTrue(day.IsWeekday());

      day = day.AddDays(1);
      Assert.IsTrue(day.IsWeekday());
    }
  }
}
